﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Utility;

namespace Classes
{
    public class Database
    {
        #region fields
        //not a property, because properties cannot be passed by reference (see LoadDatabase).
        public Organization mainOrganization;
        public const string ErrorOpeningMessage = "Unable to open database!";

        #endregion

        public void LoadDatabase(string path)
        {
            mainOrganization = new Organization();
            Serializer.Deserialize<Organization>(ref mainOrganization, path);
        }
        public void SaveDatabase(string path)
        {
            if (mainOrganization == null)
                return;
            Serializer.Serialize<Organization>(mainOrganization, path);
        }
    }
}
